//
//  DetailCombatViewController.m
//  LOL_JewelBox
//
//  Created by dllo on 15/5/5.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "DetailCombatViewController.h"
#import "GMDCircleLoader.h"
@interface DetailCombatViewController ()<UIWebViewDelegate>
@property(nonatomic, retain)UIWebView *webView;
@end

@implementation DetailCombatViewController

- (void)dealloc
{
    [_webView release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self loadWebView];

}
- (void)loadWebView
{
    NSURL *url = [NSURL URLWithString:self.combat];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, VIEWWIDTH, VIEWHEIGHT - 64)];
    self.webView.backgroundColor = [UIColor whiteColor];
    self.webView.scalesPageToFit = YES;
    self.webView.delegate = self;
    self.webView.keyboardDisplayRequiresUserAction = YES;
    
    [self.view addSubview:self.webView];
     [self.webView loadRequest:request];
    [_webView release];
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [GMDCircleLoader setOnView:self.view withTitle:@"加载中..." animated:YES];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [GMDCircleLoader hideFromView:self.view animated:YES];
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"网页加载失败" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil];
    [alert show];
    [alert release];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
